import axios from "axios"; 

// axios.defaults.baseURL = ''  //正式
axios.defaults.baseURL = 'https://cnodejs.org/api/v1' //测试


axios.defaults.headers.post["Content-Type"] = "application/json;charset=utf-8";

axios.defaults.withCredentials = true; 

axios.defaults.timeout = 15000;

axios.interceptors.request.use(
    config => {
        return config;
    },
    error => {
        return Promise.reject(error);
    }
);

axios.interceptors.response.use(
    response => {
        if (response.status == 200) {
            return Promise.resolve(response);
        } else {
            return Promise.reject(response);
        }
    },
    error => {
        console.log(error);
    }
);
export default axios
